package com.lnsoft.dqfs.server.handle;

import com.lnsoft.dqfs.server.dao.DqfsDao;
import com.lnsoft.dqfs.server.handle.codec.Dqfs101Decoder;
import com.lnsoft.dqfs.server.handle.codec.Dqfs101Encoder;
import com.lnsoft.dqfs.server.handle.codec.Frame;
import com.lnsoft.dqfs.server.handle.threadpools.ServiceInvokePools;
import com.lnsoft.dqfs.server.util.UpgradePackageCache;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
//@Slf4j
public class HandleFactory {

    @Autowired
    private ServiceInvokePools invokePools;
//    @Autowired
//    private UpgradePackageCache upgradePackageCache;
    @Autowired
    private DqfsDao dqfsDao;

    public HeartBeatServerHandle createHeartBeatServerHandle(Frame frame){
        return  new HeartBeatServerHandle(frame,dqfsDao);
    }

    public Dqfs101Decoder createDqfs101Decoder(Frame frame, UpgradePackageCache upgradePackageCache){
        return new Dqfs101Decoder(frame,upgradePackageCache,dqfsDao);
    }

    public Dqfs101Encoder createDqfs101Encoder(){
        return new Dqfs101Encoder();
    }

    public DqfsChannelHandle createDqfsChannelHandle(Frame frame){
        return new DqfsChannelHandle(frame,invokePools);
    }

}
